<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
    <link href="css/style.css" rel="stylesheet"/>
    <link href="css/base.css" rel="stylesheet"/>
    <script src="js/jquery1.42.min.js" type="text/javascript"></script>
    <script src="js/jquery.SuperSlide.2.1.3.js" type="text/javascript"></script>
    <script src="js/flexible.min.js" type="text/javascript"></script>
    <script src="../../layui-v2.2.5/layui/layui.js" charset="utf-8"></script>
    <link rel="stylesheet" href="../../layui-v2.2.5/layui/css/layui.css" media="all">
    <title>交易记录</title>
</head>
<body style="background-color: rgb(242,242,242);">
<c:if test="${fn:length(data.list)==0}">
    <div>
        <img src="img/hy28.png" class='record_img'>
        <div class='record'>暂无交易记录</div>

    </div>
</c:if>
<c:if test="${fn:length(data.list)>0}">
    <c:forEach items="${data.list}" var="i">

        <div class='commodity'>
            <div class='commodity_bianhao'>交易编号: ${i.id}</div>
            <div class='commodity_all'>
                <img src='${i.imgPath}' class='commodity_image'>
                <div class='commodityInfo'>
                    <div class='leixing'>
                        <div class='one'>类型<span></span></div>
                        :
                        <div>${i.commodityName}</div>
                    </div>
                    <div class='zhekou'>
                        <div class='one'>折扣价<span></span></div>
                        :
                        <div>${i.feedbackValue}</div>
                    </div>
                    <div class='time'>
                        <div>${i.createTime}</div>
                    </div>
                </div>
            </div>
        </div>

    </c:forEach>
    <div id="fenye"></div>
</c:if>

<script >

    layui.use('laypage', function () {
        var laypage = layui.laypage;


        laypage.render({
            elem: 'fenye'
            , count: ${data.totalRows}
            , limit: 4//数据总数，从服务端得到
            , curr:${data.currentPage}
            , hash: true
            , jump: function (obj, first) {
                //obj包含了当前分页的所有参数，比如：
                console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                console.log(obj.limit); //得到每页显示的条数
                //首次不执行
                if (!first) {
                    window.location.href = "/mobile/toTradeRecordPage?page=" + obj.curr + "&limit=" + obj.limit;
                }
            }
        });

    });

</script>
</body>
</html>